package com.isoft.data.util;

import com.fasterxml.jackson.dataformat.xml.XmlMapper;
import com.fasterxml.jackson.dataformat.xml.ser.ToXmlGenerator;

import java.io.File;
import java.io.IOException;

public class ParseXmlUtil {
    public static <T> T parseFromFile(String path,String fileName,Class<T>valueType) throws IOException {
        XmlMapper xmlMapper = new XmlMapper();
        xmlMapper.configure(ToXmlGenerator.Feature.WRITE_XML_DECLARATION,true);
        return xmlMapper.readValue(new File(path+File.separator+fileName ),valueType);
    }
}
